package com.hisan.yyq;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

/**
 * 创建时间 : 2017/11/3
 * 创建人：yangyingqi
 * 公司：嘉善和盛网络有限公司
 * 备注：无
 */
public class MainActivity extends AppCompatActivity implements PCDPopUpWindow.OnCheckChangeListener{
    private PCDPopUpWindow popUpWindow;
    private TextView name;
    private String city;
    private String province;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        popUpWindow = new PCDPopUpWindow(this,"addr.db",this);
        name=findViewById(R.id.select);
        name.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                popUpWindow.showAsDropDown(view);
            }
        });
    }

    @Override
    public void setCityText(String cityText, int cityId) {
        city=cityText;
        Log.v("xxx",cityText);
    }

    @Override
    public void setProvinceText(String provinceText, int provinceId) {
        Log.v("xxx",provinceText);
        province=provinceText;
    }

    @Override
    public void setDistrictText(String areaText, int areaId) {
        String addr = province + "\t" + city + "\t" + areaText;
        name.setText(addr);
    }

}
